answer "No match for keyword " "e& holder"e
pop card
end if
end if
click at 0,0 --disable selection
end mouseUp
On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
-- handles option-click to create new reference
if the OptionKey is down then
if the locktext of the target is true then
put true into DidUnlock
set locktext of target to false
else
put false into DidUnlock
end if
set the cursor to 2
repeat while (the OptionKey is down) and (item 1 of the rect of target <= item 1 of the mouseLoc) and (item 1 of the mouseLoc <= item 3 of the rect of target) and (item 2 of the rect of target <= item 2 of the mouseLoc) and (item 2 of the mouseLoc <= item 4 of the rect of target)
if the Mouse is down then
click at the MouseLoc
click at the ClickLoc
if the selection <> empty then
-- this is XrefText code
put the selection into holder
type holder & "*"
push card
find holder in field keywords
if the result is not empty then
doMenu New Card
put holder into field keywords
set the name of this card to holder
get the number of lines in card field finder of card theIndex
put holder into line it+1 of card field finder of card theIndex
else
put the length of holder into hl
put the length of word 1 of field keywords into kl
if hl<>kl then
answer "Close match but not exact!" with "Good Enough" or "New Card"
if it contains "New" then
set lockscreen to true
go prev
doMenu New Card
put holder into field keywords
set the name of this card to holder
get the number of lines in card field finder of card theIndex
put holder into line it+1 of card field finder of card theIndex
set lockscreen to false
end if
end if
end if
end if
if field body is empty then
type tab
else
click at -1,-1
end if
end if
end repeat
if DidUnlock then
set the locktext of the target to true
end if
end if
end MouseWithin
-- part 44 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=253 right=283 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 32462 / 32462
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: ?
----- HyperTalk script -----
on mouseUp
set lockscreen to true
go card ayuda
set lockscreen to false
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=195 right=225 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 29114 / 29114
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Back
----- HyperTalk script -----
on mouseUp
set lockscreen to true
if the number of this card = 1 then
answer "Careful. You might leave this stack." with Cancel or OK
if it = "OK" then
go back
else
exit mouseup
end if
else
pop card
end if
set lockscreen to false
end mouseUp
-- part 8 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=166 right=196 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: New Stack
----- HyperTalk script -----
on mouseUp
set lockscreen to true
put the short name of this stack into checker
doMenu New Stack...
get the short name of this stack
if it = checker then exit mouseup
put it into field "keywords"
push card
go back
---
go to second card
doMenu "Copy Card"
pop card
doMenu "Paste Card"
push card
---
go to first card of stack checker
doMenu "Copy Card"
pop card
go prev
doMenu "Paste Card"
set lockscreen to false
click at the loc of button "Re-Index"
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=282 right=312 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 1011 / 1011
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Home
----- HyperTalk script -----
on mouseUp
visual effect iris close to black
visual effect iris open to white
go home
end mouseUp
-- part 12 (button)
-- low flags: 80
-- high flags: 8004
-- rect: left=355 top=72 right=98 bottom=384
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: OK
----- HyperTalk script -----
on mouseUp
hide bkgnd button OK
show field body
end mouseUp
-- part 17 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=224 right=254 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 21449 / 21449
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: first card
----- HyperTalk script -----
on mouseUp
if the number of this card > 1 then
set lockscreen to true
go to first card
set lockscreen to false
else
play boing
answer "You're already at the first card!"
end if
end mouseUp
-- part 32 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=137 right=167 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Import Text
----- HyperTalk script -----
on mouseUp
if the number of this card > 2 then
if field body is empty then
put FileName("TEXT") into theFile
if theFile is not empty then
open file theFile
read from file theFile for 30000
put it into bkgnd field body
close file theFile
end if
else
answer "Import Text: Replace or Add to field contents?" with "Replace" or "Add" or "Cancel"
if it = "Cancel" then exit mouseup
if it = "Replace" then
put FileName("TEXT") into theFile
if theFile is not empty then
open file theFile
read from file theFile for 30000
put it into bkgnd field body
close file theFile
end if
else
put return after last line of bkgnd field body
put FileName("TEXT") into theFile
if theFile is not empty then
open file theFile
read from file theFile for 30000
put the number of lines in field body into liner
put it after line liner of bkgnd field body
close file theFile
end if
end if
end if
else
play boing
Answer "Don't import to Index or Help Card!"
end if
end mouseUp
-- part 33 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=97 right=138 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 26884 / 26884
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: pict
----- HyperTalk script -----
on mouseUp
if the number of this card > 2 then
answer "Change to Picture or Text?" with Text or Picture
if it contains "Text" then
show tool window
choose select tool
doMenu Select All
doMenu Clear Picture
choose browse tool
hide tool window
hide pattern window
else
show pattern window
show tool window
choose rectangle tool
set filled to false
drag from (item 1 of the rect of field keywords), (item 2 of the rect of field keywords) to (item 3 of the rect of field keywords), (item 4 of the rect of field keywords)
drag from 0,28 to 512,342
choose bucket tool
set pattern to 1
click at 250,250
choose text tool
set the textfont to Geneva
set the textsize to 9
click at 10,320
type "Don't use eraser. Use white brush instead."
click at 10,330
type "Command-Space will toggle the menubar on or off."
choose brush tool
end if
else
play boing
answer "Uh-uh. You don't want to change this card."
end if
end mouseUp
-- part 36 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=0 top=61 right=98 bottom=34
-- title width / last selected line: 0
-- icon id / first selected line: 1007 / 1007
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: output
----- HyperTalk script -----
on mouseUp
answer "Output to printer or to text file?" with "Printer" or "File" or "Cancel"
if it = "Cancel" then
exit mouseup
else if it = "Printer" then
answer "Print the stack or a report of its text" with "Stack" or "Report" or "Cancel"
if it = "Cancel" then
exit mouseup
else if it = "Stack" then
doMenu Print Stack...
else if it = "Report" then
doMenu Print Report...
end if
else if it = "File" then
answer "Save a file of the Stack or of this Card?" with "Stack" or "Card" or "Cancel"
if it = "Cancel" then
exit mouseup
else if it = "Stack" then
put the number of cards into counter
go to first card
put the short name of this stack & ".text" into tfilename
Get PutFile("Save text as:",tfilename)
if it is empty then exit mouseup
put it into textfile
set cursor to 4
set the loc of message to 10,120
put "Writing to file " & textfile & ". Please wait..."into message
open file textfile
repeat (counter - 1)
go next card
write field keywords to file textfile
write return to file textfile
write field body to file textfile
write return to file textfile
write return to file textfile
end repeat
close file textfile
go first card
play harpsichord c e g bb
flash 1
put "Done." into message
wait 2 seconds
hide message
else if it = "Card" then
put the short name of this card & ".text" into tfilename
Get PutFile("Save text as:",tfilename)
if it is empty then exit mouseup
put it into textfile
open file textfile
write field keywords to file textfile
write return to file textfile
write field body to file textfile
close file textfile
end if
end if
end mouseUp
-- part 45 (field)
-- low flags: 00
-- high flags: 2004
-- rect: left=22 top=33 right=61 bottom=188
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: keywords
----- HyperTalk script -----
on mouseUp
set cursor to 4
put field keywords into holder
put the number of this card into num
put empty into field inlinks
put "One moment, Please." into line 2 of field inlinks
show field inlinkstitle
show field inlinks
show bkgnd button "Hide"
put "What links to " & holder &"?" into field inlinkstitle
put the number of cards into counter
set lockscreen to true
put empty into field inlinks
-- The next section is commented out and replaced with my own code
-- repeat counter
-- go next
-- if field body contains holder then
-- put return after last line of field inlinks of card num
-- put field keywords after last line of field inlinks of card num
-- end if
-- end repeat
-- Here is my search code
put 0 into first_card
push card
go card 2
repeat
find holder in field body
if (the result is empty) and (the number of this card is not first_card) then
if first_card is 0 then put the number of this card into first_card
if (field "keywords" is not holder) then
put return after last line of field inlinks of card num
put field keywords after last line of field inlinks of card num
end if
go next
else
exit repeat
end if
end repeat
pop card
-- end of my search code
play harpsichord
flash 1
set lockscreen to false
click at 0,0 --disable selection
set lockText of the target to true
if field inlinks is empty then
hide field inlinks
hide field inlinkstitle
hide bkgnd button Hide
end if
end mouseUp
-- part 41 (field)
-- low flags: 81
-- high flags: 2002
-- rect: left=258 top=32 right=52 bottom=426
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: inlinkstitle
-- part 42 (field)
-- low flags: 81
-- high flags: 2007
-- rect: left=258 top=51 right=114 bottom=426
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: inlinks
----- HyperTalk script -----
on mouseUp
if the selection is empty then
set lockText of the target to false
repeat two times
click at the clickLoc
end repeat
put the selection into holder
push card
visual effect wipe right to black
visual effect wipe left
find holder in field keywords -- This line is the link
if the result is not empty then
answer "No match for keyword " "e& holder"e